<template>
    <el-menu :default-active="this.$router.path" class="el-menu-vertical-demo" @open="handleOpen" @close="handleClose"
        background-color="#545c64" text-color="#fff" active-text-color="#ffd04b">
        <el-menu-item index="/aboutView" @click.native="handleSelectMenu('/aboutView')" v-if="this.userInfo.mark == 1">
            <i class="el-icon-menu"></i>
            <span slot="title">专利管理系统驾驶舱</span>
        </el-menu-item>
        <el-menu-item index="/newAbout" @click.native="handleSelectMenu('/newAbout')" v-if="this.userInfo.mark == 2">
            <i class="el-icon-menu"></i>
            <span slot="title">专利管理系统驾驶舱</span>
        </el-menu-item>


        <el-submenu index="/markModel">
            <template slot="title">
                <i class="el-icon-location"></i>
                <span>专利价值</span>
            </template>
            <el-menu-item-group>

                <el-menu-item index="/markModel" @click.native.stop="handleSelectMenu('/markModel')">客观价值</el-menu-item>

            </el-menu-item-group>
            <el-menu-item-group>

                <el-menu-item index="/subjective" @click.native.stop="handleSelectMenu('/subjective')">主观价值</el-menu-item>

            </el-menu-item-group>
            <el-menu-item-group>

                <el-menu-item index="/synthesis" @click.native.stop="handleSelectMenu('/synthesis')">综合价值 </el-menu-item>

            </el-menu-item-group>

        </el-submenu>


        <el-menu-item index="/recommend" @click.native="handleSelectMenu('/recommend')">
            <i class="el-icon-menu"></i>
            <span slot="title">专利转化推荐企业</span>
        </el-menu-item>


        <el-submenu index="1">
            <template slot="title">
                <i class="el-icon-location"></i>
                <span>专利年费</span>
            </template>
            <el-submenu index="1-2">
                <template slot="title">年费监控</template>
                <el-menu-item index="1-2-1" @click.native.stop="handleSelectMenu('/annualFee')">监控列表</el-menu-item>
                <el-menu-item index="1-2-2" @click.native.stop="handleSelectMenu('/recycle')">年费回收站</el-menu-item>
            </el-submenu>

            <el-menu-item index="/warn" @click.native="handleSelectMenu('/warn')">

                <span slot="title">年费提醒</span>
            </el-menu-item>

        </el-submenu>





        <el-menu-item index="/sample" @click.native="handleSelectMenu('/sample')">
            <i class="el-icon-menu"></i>
            <span slot="title">{{ mingcheng }}专利库</span>
        </el-menu-item>


        <el-menu-item index="/outpatient" @click.native="handleSelectMenu('/outpatient')">
            <i class="el-icon-menu"></i>
            <span slot="title">专利门诊</span>
        </el-menu-item>

        <!-- <el-submenu index="/aboutView">
            <template slot="title">
                <i class="el-icon-location"></i>
                <span>基础信息</span>
            </template>
            <el-menu-item-group>

                <el-menu-item index="/patent" @click.native.stop="handleSelectMenu('/patent')">首医系统专利清单</el-menu-item>

            </el-menu-item-group>

        </el-submenu> -->





        <!-- <el-menu-item index="3" @click.native="handleSelectMenu('/markModel')">
            <i class="el-icon-document"></i>
            <span slot="title">专利价值</span>
        </el-menu-item> -->
        <!-- <el-menu-item index="3" disabled>
            <i class="el-icon-document"></i>
            <span slot="title">导航三</span>
        </el-menu-item>
        <el-menu-item index="4">
            <i class="el-icon-setting"></i>
            <span slot="title">导航四</span>
        </el-menu-item> -->
    </el-menu>
</template>

<script>
import Cookies from "js-cookie";

export default {
    data() {
        return {
            userInfo: {},
            mingcheng: ''
        }
    },
    mounted() {
        this.getCookie();
        console.log(this.$router.options.routes[2].redirect)
    },
    methods: {
        getCookie() {
            this.userInfo = JSON.parse(Cookies.get("userInfo"));
            // this.$router.options.routes[2].redirect = this.userInfo.mark == 1 ? 'aboutView' : 'newAbout'
            // if (this.userInfo.mark == 1) {
            //
            //     if (this.$router.options.routes[2].redirect == 'aboutView') {
            //         this.$router.push({ path: '/aboutView' })
            //     }
            // } else {
            //     if (this.$router.options.routes[2].redirect == 'newAbout') {
            //         this.$router.push({ path: '/newAbout' })
            //     }
            // }

            console.log(this.userInfo.mark)
            if (this.userInfo.danwei == '首都医科大学附属北京儿童医院') {
                this.mingcheng = '儿童医院'
            } else if (this.userInfo.danwei == '首都医科大学附属北京安贞医院') {
                this.mingcheng = '北京安贞医院'
            } else if (this.userInfo.danwei == '中日友好医院') {
                this.mingcheng = '中日友好医院'
            } else if (this.userInfo.danwei == '北京大学第一医院') {
                this.mingcheng = '北京大学第一医院'
            }
        },
        handleOpen(key, keyPath) {
            console.log(key, keyPath);
        },
        handleClose(key, keyPath) {
            console.log(key, keyPath);
        },
        handleSelectMenu(path) {
            if (this.$route.path != path) {
                this.$router.push(path)
            }

        }
    }
}
</script>